package com.sky.blue.xmltool.dom4j;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.junit.Test;

import java.io.File;

public class Dom4jUtils {

    @Test
   public void test1() throws Exception{

        /**
         * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
         * <User>
         *     <userId>1</userId>
         *     <userName></userName>
         *     <password>@sun123</password>
         *     <birthday>2019-11-13T20:33:05.737+08:00</birthday>
         *     <money>1000.0</money>
         * </User>
         */
        SAXReader saxReader =new SAXReader();
        Document document = saxReader.read(new File("D:/user.xml"));
        System.out.println(document.asXML());
        /**
         * <?xml version="1.0" encoding="UTF-8"?>
         * <User>
         *     <userId>1</userId>
         *     <userName/>
         *     <password>@sun123</password>
         *     <birthday>2019-11-13T20:33:05.737+08:00</birthday>
         *     <money>1000.0</money>
         * </User>
         */






    }
}
